package com.veeder.datacollection.config;

import java.io.IOException;

import com.veeder.datacollection.exception.ConfigurationException;
import com.veeder.datacollection.util.GlobalConstants;

public class StationConfig {

	public static StationParam loadParams() throws ConfigurationException {
		StationParam param = new StationParam();

		try {
			IniReader iniReader = new IniReader(GlobalConstants.ConfigFileLocation + "Collector.ini");
//			param.setWebApiUrl(iniReader.getValue("CollectorConfig", "WebApiUrl"));
			param.setConsoleModel(iniReader.getValue("ATGConfig", "ConsoleModel"));

			// add the length configuration.
//			String stationConfiged = iniReader.getValue("CollectorConfig", "StationId");

//			if (stationConfiged == null || stationConfiged.length() <= 0) {
//				throw new ConfigurationException("StationId is null");
//			} else if (stationConfiged.length() > 20) {
//				throw new ConfigurationException("StationId too long");
//			} else {
//				param.setStationId(stationConfiged);
//			}

		} catch (IOException e) {
			throw new ConfigurationException(e.toString());
		}

		return param;
	}

}
